import java.util.LinkedHashMap;
import java.util.Map;


public class GenericGraph {
	private Map <String, Vertex> nodes;


	public GenericGraph(){
		nodes = new LinkedHashMap<String, Vertex>();
	}

	public void addVertex(String name){
		nodes.put(name, new Vertex(name));
	}
	
	public Vertex getVertex(String name){
		return nodes.get(name);
	}
	
	public Map<String, Vertex> getVertices(){
		return nodes;
	}
	
	public void putEdge(String nameFrom, String nameTo, double distance){
		Vertex vertexFrom = nodes.get(nameFrom);
		Vertex vertexTo = nodes.get(nameTo);
		Edge edge = new Edge (vertexTo, distance, vertexFrom);
		vertexTo.addIncomingEdge(edge);
		vertexFrom.addOutgoingEdge(edge);
	}

	
	
}